package co.edu.eam.iso.chart.model;

import java.math.BigDecimal;

import co.edu.eam.iso.util.BigDecimalUtil;

/**
 * @author Giovanny Ramirez
 */
public class ChartData {

	private BigDecimal weight;
	private BigDecimal quality;
	private BigDecimal qualityVStotal;
	private BigDecimal totalQuality;
	private int count;
	
	public ChartData() {
		weight = BigDecimal.ZERO;
		quality = BigDecimal.ZERO;
		qualityVStotal = BigDecimal.ZERO;
		totalQuality = BigDecimal.ZERO;
		count = 0;
	}
	
	public double averageWeight() {
		return BigDecimalUtil.divide(weight, BigDecimalUtil.wrap(count)).doubleValue();
	}
	
	public double averageQuality() {
		return BigDecimalUtil.divide(quality, BigDecimalUtil.wrap(count)).doubleValue();
	}
	
	public double averageQualityVStotal() {
		return BigDecimalUtil.divide(qualityVStotal, BigDecimalUtil.wrap(count)).doubleValue();
	}
	
	public double averageTotalQuality() {
		return BigDecimalUtil.divide(totalQuality, BigDecimalUtil.wrap(count)).doubleValue();
	}	
	
	public void sumWeight(BigDecimal value) {
		weight = BigDecimalUtil.add(weight, value);
	}
	
	public void sumQuality(BigDecimal value) {
		quality = BigDecimalUtil.add(quality, value);
	}
	
	public void sumQualityVStotal(BigDecimal value) {
		qualityVStotal = BigDecimalUtil.add(qualityVStotal, value);
	}
	
	public void sumTotalQuality(BigDecimal value) {
		totalQuality = BigDecimalUtil.add(totalQuality, value);
	}	
	
	public void sumCount() {
		count++;
	}
	
	public BigDecimal getWeight() {
		return weight;
	}
	
	public void setWeight(BigDecimal weight) {
		this.weight = weight;
	}
	
	public BigDecimal getQuality() {
		return quality;
	}
	
	public void setQuality(BigDecimal quality) {
		this.quality = quality;
	}
	
	public BigDecimal getQualityVStotal() {
		return qualityVStotal;
	}
	
	public void setQualityVStotal(BigDecimal qualityVStotal) {
		this.qualityVStotal = qualityVStotal;
	}
	
	public BigDecimal getTotalQuality() {
		return totalQuality;
	}
	
	public void setTotalQuality(BigDecimal totalQuality) {
		this.totalQuality = totalQuality;
	}
	
	public int getCount() {
		return count;
	}
	
	public void setCount(int count) {
		this.count = count;
	}

}
